--spTipoDocumentoSel null
create procedure spTipoDocumentoSel
  @Codigo        int = null
with encryption
as
	declare @intError int
	begin transaction
	
	Select * from TipoDocumento 
		where Codigo  = isnull(@Codigo,Codigo)
		order by nombre
	
    set @intError = @@Error
    if (@intError <> 0) goto onError
  
	commit transaction
	return @intError

onError:
  if @@TranCount > 0 rollback transaction
  return @intError
go